/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package test;

import processing.core.PApplet;
/**
 *
 * @author user
 */
public class Point {
    PApplet parent;

    private float pointX;
    private float pointY;

    private float radius;

    public float getPointX() {
        return pointX;
    }

    public float getPointY() {
        return pointY;
    }

    public float getRadius() {
        return radius;
    }
   

    public Point(PApplet p, float x, float y, float r) {
        parent = p;

        pointX = x;
        pointY = y;

        radius = r;
        
    }
    
    public void display() {
        parent.ellipse(pointX, pointY, 2*radius, 2*radius);        
    }
    
    public boolean inArea(float mX, float mY) {
        float distance = distancePoint(mX, mY);
        if(distance <= radius) {
            return true;
        }
        // TODO Laske onko etäisyys pisteestä pienempi kuin radius
        return false;
    }

    public float distancePoint(float mX, float mY) {
        return (float) Math.sqrt(Math.pow((mX - pointX), 2) + Math.pow((mY - pointY), 2));
    }

    public void movePoint(float mX, float mY) {
        this.pointX = mX;
        this.pointY = mY;
    }

}
